package org.example.fact;

import java.util.HashMap;
import java.util.Map;

/**
 * Record接口
 */
public class Fact {

  private volatile boolean isCanModify = true;


  private Map<String, Object> mapData;


  public Fact() {
    this.mapData = new HashMap<>();
  }

  public Fact(int capacity) {
    this.mapData = new HashMap<>(capacity, 1f);
  }

  public Fact(Map<String, Object> mapData) {
    this.mapData = mapData;
  }

  public boolean isCanModify() {
    return isCanModify;
  }

  public void setCanModify(boolean canModify) {
    this.isCanModify = canModify;
  }

  public void setFactData(String key, Object value) {
    this.mapData.put(key, value);
  }

  public Object getFactData(String key) {
    return this.mapData.get(key);
  }

  public void pullAllFactData(Map<String, Object> map) {
    this.mapData.putAll(map);
  }
}
